

var salaryDistributionDataCherk;// 定义一个全局变量
//初始化页面数据

function initial(){
    /**
    JSON.stringify()是将JavaScript对象转换为json字符串
    JSON.parse(jsonstr)是将json字符串转换为javascript对象
    */
    $.ajax({
        url:"http://localhost/PersonManSystem/salary/distribution/nocheck.action",//待补充
        type:"get",
        dataType:'json',
        contentType:'application/json;charset=utf-8',
        success:function(data){

            salaryDistributionDataCherk = data;
            // instnamewhenchange(data);
            /*initSalaryLoadData(data, '2*/
            $("input[name = 'nocheckXCFH']").val(data['msg']);
            $.each(data['data'], function(i, item){
                var tbody = $('<tr style="FONT-WEIGHT: bold; FONT-STYLE: normal; BACKGROUND-COLOR: #eeeeee; TEXT-DECORATION: none"></tr>');

                 tbody.append("<td>"+item.salarydistributionid+"</td>");
                 tbody.append("<td>"+item.firstinstname+"</td>");
                 tbody.append("<td>"+item.secondinstname+"</td>");
                 tbody.append("<td>"+item.thirdinstname+"</td>");
                 tbody.append("<td>"+item.personnum+"</td>");
                 tbody.append("<td>"+item.basicsalarysum+"</td>");


                 tbody.append("<td><input type='button' id='"+item.thirdinstname+"' value='复核' onclick='getid(this)'></td>");

                 $("#grid").append(tbody);
            });


        },
        error:function(XMLHttpRequest, textStatus, errorThrown){
            alert("Error");
            alert(XMLHttpRequest.status);
            alert(XMLHttpRequest.readyState);
            alert(textStatus);
        }
    });

}


    function getid(obj){
        $(salaryDistributionDataCherk['data']).each(function(){
            if (obj.id == this.thirdinstname){
                sessionStorage.setItem("XCFFFHsalarydistributionid", this.salarydistributionid);
                sessionStorage.setItem("XCFFFHthirdinstname",this.thirdinstname);
                sessionStorage.setItem("XCFFFHsecondinstname", this.secondinstname);
                sessionStorage.setItem("XCFFFHfirstinstname", this.firstinstname);
                sessionStorage.setItem("XCFFFHbasicsalarysum", this.basicsalarysum);
                sessionStorage.setItem("XCFFFHpersonnum", this.personnum);


            }
        });
        window.location = 'XCFFFH_1.html';
    }
